package com.lagou.subjectthree;

import java.math.BigDecimal;

/**
 * 手机通话套餐
 */
public class CallCombo extends Combo implements ICall {
    /**
     * 通话时长（分钟）
     */
    private float CallTime;
    /**
     * 短信条数
     */
    private int SMSCount;

    /**
     * 构造函数
     *
     * @param monthCost
     * @param callTime
     * @param SMSCount
     */
    public CallCombo(BigDecimal monthCost, float callTime, int SMSCount) {
        super(monthCost);
        setCallTime(callTime);
        setSMSCount(SMSCount);
        System.out.println("通话套餐模块");
    }

    /**
     * 打电话功能
     *
     * @param minute
     */
    @Override
    public void MakePhone(PhoneCard phoneCard, float minute) {
        System.out.println("卡号：" + phoneCard.getCardNum() + "用户名：" + phoneCard.getUserName() + "打电话：" + minute + "分钟");
        //消费记录
        UserCostInfo costInfo = new UserCostInfo(phoneCard.getUserName(), minute, 0, getMonthCost());
        //扣除消费的金额
        phoneCard.setCallTime(phoneCard.getCallTime() + minute);
        phoneCard.setBalance(phoneCard.getBalance().subtract(getMonthCost()));
    }

    /**
     * 输出套餐信息
     */
    public void ShowComboInfo() {
        System.out.println("通话时长（分钟）:" + getCallTime() + "  短信条数：" + getSMSCount() + "  每月费用：" + getMonthCost());
    }


    /**
     * 自定义成员方法实现特征的获取和修改
     *
     * @return
     */
    public float getCallTime() {
        return CallTime;
    }

    public void setCallTime(float callTime) {
        CallTime = callTime;
    }

    public int getSMSCount() {
        return SMSCount;
    }

    public void setSMSCount(int SMSCount) {
        this.SMSCount = SMSCount;
    }


}
